/**
 * http://code.google.com/p/gwt-spot
 * 
 * GWT-Spot -- Copyright 2008-2009
 *          -- by Dunkel, Ricardo
 *  
 */
package de.ricardodunkel.gwtspot.client.api.ui.common;

import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Image;

/**
 * Common image widget utility for image creation.
 * 
 * @author Dunkel, Ricardo
 * 
 * @version 0.1
 * 
 */
public class ImageUtility extends WidgetUtility {

	/**
	 * Does create a <em>standard</em> image.
	 * 
	 * @param url  An images URl to set.
	 * 
	 * @return A new {@link Image} object.
	 */
	public static Image createImage(String url) {
		return createImage(null,url,null);
	}
	
	/**
	 * Does create a <em>basic</em> image.
	 * 
	 * @param title  An image title used within.
	 * @param url  An images URl to set.
	 * 
	 * @return A new {@link Image} object.
	 */
	public static Image createImage(String title, String url) {
		return createImage(title,url,null);
	}
	
	/**
	 * Does create an <em>extended</em> new image.
	 * 
	 * @param title  An image title used within, <em>HTML</em> composed.
	 * @param url  An images URl to set.
	 * @param style  A style to set for image, if desired.
	 * 
	 * @return A new {@link Image} object.
	 */
	public static Image createImage(String title, String url, String style) {
		Image img = new Image(url);
		setWidgetProperties(img, new HTML(title).getHTML(), style);
		return img;
	}
	
}
